//------------------------------------------------------------------------------
// <autogenerated>
//     This code was generated by a tool.
//     Runtime Version: 1.0.2914.16
//
//     Changes to this file may cause incorrect behavior and will be lost if 
//     the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------

namespace ManageTerritories {
    using System;
    using System.Data;
    using System.Xml;
    using System.Runtime.Serialization;
    
    
    [Serializable()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public class territoriesDataset : System.Data.DataSet {
        
        private TerritoriesDataTable tableTerritories;
        
        public territoriesDataset() {
            this.InitClass();
        }
        
        private territoriesDataset(SerializationInfo info, StreamingContext context) {
            this.InitClass();
            this.GetSerializationData(info, context);
        }
        
        [System.ComponentModel.Browsable(false)]
        [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)]
        public TerritoriesDataTable Territories {
            get {
                return this.tableTerritories;
            }
        }
        
        protected override bool ShouldSerializeTables() {
            return false;
        }
        
        protected override bool ShouldSerializeRelations() {
            return false;
        }
        
        protected override void ReadXmlSerializable(XmlReader reader) {
            this.ReadXml(reader, XmlReadMode.IgnoreSchema);
        }
        
        protected override System.Xml.Schema.XmlSchema GetSchemaSerializable() {
            System.IO.MemoryStream stream = new System.IO.MemoryStream();
            this.WriteXmlSchema(new XmlTextWriter(stream, null));
            stream.Position = 0;
            return System.Xml.Schema.XmlSchema.Read(new XmlTextReader(stream), null);
        }
        
        private void InitClass() {
            this.DataSetName = "territoriesDataset";
            this.Namespace = "http://www.tempuri.org/territoriesDataset.xsd";
            this.tableTerritories = new TerritoriesDataTable();
            this.Tables.Add(this.tableTerritories);
        }
        
        private bool ShouldSerializeTerritories() {
            return false;
        }
        
        public delegate void TerritoriesRowChangeEventHandler(object sender, TerritoriesRowChangeEvent e);
        
        public class TerritoriesDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnTerritoryID;
            
            private DataColumn columnTerritoryDescription;
            
            private DataColumn columnRegionID;
            
            internal TerritoriesDataTable() : 
                    base("Territories") {
                this.InitClass();
            }
            
            [System.ComponentModel.Browsable(false)]
            public int Count {
                get {
                    return this.Rows.Count;
                }
            }
            
            internal DataColumn TerritoryIDColumn {
                get {
                    return this.columnTerritoryID;
                }
            }
            
            internal DataColumn TerritoryDescriptionColumn {
                get {
                    return this.columnTerritoryDescription;
                }
            }
            
            internal DataColumn RegionIDColumn {
                get {
                    return this.columnRegionID;
                }
            }
            
            public TerritoriesRow this[int index] {
                get {
                    return ((TerritoriesRow)(this.Rows[index]));
                }
            }
            
            public event TerritoriesRowChangeEventHandler TerritoriesRowChanged;
            
            public event TerritoriesRowChangeEventHandler TerritoriesRowChanging;
            
            public event TerritoriesRowChangeEventHandler TerritoriesRowDeleted;
            
            public event TerritoriesRowChangeEventHandler TerritoriesRowDeleting;
            
            public void AddTerritoriesRow(TerritoriesRow row) {
                this.Rows.Add(row);
            }
            
            public TerritoriesRow AddTerritoriesRow(string TerritoryID, string TerritoryDescription, int RegionID) {
                TerritoriesRow rowTerritoriesRow = ((TerritoriesRow)(this.NewRow()));
                rowTerritoriesRow.ItemArray = new object[] {
                        TerritoryID,
                        TerritoryDescription,
                        RegionID};
                this.Rows.Add(rowTerritoriesRow);
                return rowTerritoriesRow;
            }
            
            public TerritoriesRow FindByTerritoryID(string TerritoryID) {
                return ((TerritoriesRow)(this.Rows.Find(new object[] {
                            TerritoryID})));
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            private void InitClass() {
                this.columnTerritoryID = new DataColumn("TerritoryID", typeof(string), "", System.Data.MappingType.Element);
                this.columnTerritoryID.AllowDBNull = false;
                this.columnTerritoryID.Unique = true;
                this.Columns.Add(this.columnTerritoryID);
                this.columnTerritoryDescription = new DataColumn("TerritoryDescription", typeof(string), "", System.Data.MappingType.Element);
                this.columnTerritoryDescription.AllowDBNull = false;
                this.Columns.Add(this.columnTerritoryDescription);
                this.columnRegionID = new DataColumn("RegionID", typeof(int), "", System.Data.MappingType.Element);
                this.columnRegionID.AllowDBNull = false;
                this.Columns.Add(this.columnRegionID);
                this.PrimaryKey = new DataColumn[] {
                        this.columnTerritoryID};
            }
            
            public TerritoriesRow NewTerritoriesRow() {
                return ((TerritoriesRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                // We need to ensure that all Rows in the tabled are typed rows.
                // Table calls newRow whenever it needs to create a row.
                // So the following conditions are covered by Row newRow(Record record)
                // * Cursor calls table.addRecord(record) 
                // * table.addRow(object[] values) calls newRow(record)    
                return new TerritoriesRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(TerritoriesRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.TerritoriesRowChanged != null)) {
                    this.TerritoriesRowChanged(this, new TerritoriesRowChangeEvent(((TerritoriesRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.TerritoriesRowChanging != null)) {
                    this.TerritoriesRowChanging(this, new TerritoriesRowChangeEvent(((TerritoriesRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.TerritoriesRowDeleted != null)) {
                    this.TerritoriesRowDeleted(this, new TerritoriesRowChangeEvent(((TerritoriesRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.TerritoriesRowDeleting != null)) {
                    this.TerritoriesRowDeleting(this, new TerritoriesRowChangeEvent(((TerritoriesRow)(e.Row)), e.Action));
                }
            }
            
            public void RemoveTerritoriesRow(TerritoriesRow row) {
                this.Rows.Remove(row);
            }
        }
        
        public class TerritoriesRow : DataRow {
            
            private TerritoriesDataTable tableTerritories;
            
            internal TerritoriesRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tableTerritories = ((TerritoriesDataTable)(this.Table));
            }
            
            public string TerritoryID {
                get {
                    return ((string)(this[this.tableTerritories.TerritoryIDColumn]));
                }
                set {
                    this[this.tableTerritories.TerritoryIDColumn] = value;
                }
            }
            
            public string TerritoryDescription {
                get {
                    return ((string)(this[this.tableTerritories.TerritoryDescriptionColumn]));
                }
                set {
                    this[this.tableTerritories.TerritoryDescriptionColumn] = value;
                }
            }
            
            public int RegionID {
                get {
                    return ((int)(this[this.tableTerritories.RegionIDColumn]));
                }
                set {
                    this[this.tableTerritories.RegionIDColumn] = value;
                }
            }
        }
        
        public class TerritoriesRowChangeEvent : EventArgs {
            
            private TerritoriesRow eventRow;
            
            private System.Data.DataRowAction eventAction;
            
            public TerritoriesRowChangeEvent(TerritoriesRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public TerritoriesRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}
